Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Synchronize relation between contacts #1020

Merged
merged 3 commits into from
Nov 18, 2024
Merged

feat: Synchronize relation between contacts #1020

merged 3 commits into from
Nov 18, 2024

Conversation

Merkur39
Copy link
Member

Following on from the work started on this PR #985.

The aim is to synchronize relationship changes between the contacts concerned.

Copy link

bundlemon bot commented Nov 15, 2024

BundleMon

Files updated (2)
Status Path Size Limits
app/contacts.(hash).js
286.34KB (+970B +0.33%) -
intents/contacts.(hash).js
28.38KB (+50B +0.17%) -
Unchanged files (6)
Status Path Size Limits
vendors/contacts.(hash).js
926.52KB -
services/autoDefineLabels/contacts.js
305.54KB -
services/keepIndexFullNameAndDisplayNameUpToD
ate/contacts.js
305.48KB -
services/cleanRelatedContacts/contacts.js
304.91KB -
app-contacts.(hash).min.css
27.08KB -
img/icon.(hash).svg
454B -

Total files change +1020B +0.05%

Groups updated (1)
Status Path Size Limits
**/*.js
2.11MB (+1020B +0.05%) -
Unchanged groups (2)
Status Path Size Limits
**/*.css
83.72KB -
img/.
454B -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

src/locales/fr.json Outdated Show resolved Hide resolved
} catch (error) {
log.error('Error updating related contact', error)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So createRelatedContact and updateRelatedContact are equal ? Maybe you can use only one function called upsertRelatedContact. But it's your choice, sometimes it's good to have the different path explicit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, I prefer to separate the different actions.
(Initially, I was also thinking of using another CC helper in this function).

Copy link
Member Author

@Merkur39 Merkur39 Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the code because it wasn't working when removing a “relationTypes”.
This is a problem on the cozy-client side, so I'm updating “manually” to avoid delaying the feature.
See issue cozy/cozy-client#1560

@zatteo
Copy link
Contributor

zatteo commented Nov 15, 2024

Some questions, but very pleasant to read. Looks a lot like clean code.

Following on from the work started on this PR #985.

The aim is to synchronize relationship changes
between the contacts concerned.
@Merkur39 Merkur39 merged commit 243722e into master Nov 18, 2024
2 checks passed
@Merkur39 Merkur39 deleted the feat/ver-1093 branch November 18, 2024 08:38
zatteo added a commit to cozy/cozy-keys-browser that referenced this pull request Nov 18, 2024
I had to start with a special case for "me" update, because in Cozy
Contacts, relations were stored only in the contact who created the
relation.

So when "me" was updated, a relation of me could have been deleted,
and it was impossible to know which one easily, so it was impossible
to know if the contact should be removed from the extension.

With cozy/cozy-contacts#1020, relations are
propagated to the target contact.

So we will get a realtime event and we will be able to check if the
contact must be displayed or not without any special case.

And I can also check that a contact is related to me directly by checking
its relationships now.
zatteo added a commit to cozy/cozy-keys-browser that referenced this pull request Nov 18, 2024
I had to start with a special case for "me" update, because in Cozy
Contacts, relations were stored only in the contact who created the
relation.

So when "me" was updated, a relation of me could have been deleted,
and it was impossible to know which one easily, so it was impossible
to know if the contact should be removed from the extension.

With cozy/cozy-contacts#1020, relations are
propagated to the target contact.

So we will get a realtime event and we will be able to check if the
contact must be displayed or not without any special case.

And I can also check that a contact is related to me directly by checking
its relationships now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants